Execute JavaScript
If JavaScript actions have been enabled from the Admin console's Client Security options, users can opt to execute JavaScript in the browser. To create a JavaScript action, write an expression in PQL in the text editor; the output when the action is selected will be JavaScript. You can incorporate the Generative PQL Function into your statement to have results returned by the underlying LLM.
Configure a JavaScript Click Action
- Start by selecting Execute JavaScript from the Action Type list.
- Type your JavaScript into the script editor.
- Add PQL functions to your script by dragging them from the Functions library.
- Click Validate to test your script.
- Click Apply to save the jump action.
This example is used to call an alert when the button is clicked. The button is being filtered by two slicers, so the alert will display the two current slicer selections:
"alert('" + captions() + "')"
Here we see the two slicer selections (green highlight below) displayed in the alert when the button is clicked at runtime (yellow arrow below):